#!/bin/sh
#
# @file make_package
# @brief Making eclipse packages
# @author Noriaki Ando <n-ando@aist.go.jp>
#
#------------------------------
#
# This script makes eclipse package for Linux, Windows and Mac OS X.
# It tries to download Eclipse SDK all in one package, and adds EMF,
# EMF Xcore, GEF, XSD and rtmtools, and makes them packaging again to
# be distributed.
#
# ** Environment variables
#
# The following vairables can/should be set to run this script.
#
# 1. Especially ECLIPSE_VERSION, DOWNLOAD_SITE, REPOSITORY, LANGPACK_URL
# have to be set appropriate value based on chosen eclipse version.
# Current default is eclipse 3.8.1
#
# 2. OPENRTP_SITE, WORK_DIR, PKG_DIR, OS and BIT can be set for your environment.
#
#
# - ECLIPSE_HOME: A directory path to an Eclipse SDK. Under this
#                 directory, .eclipseproduct, eclipse.ini, plugins and
#                 eclipse executable should exist. If this
#                 env.variable is not set, this script tries to search
#                 eclipse directory under some directories that is set
#                 in a env.variable ECLIPSE_DIRS written in the head
#                 of this script.
#
# - ECLIPSE_VERSION: Eclipse version string to be
#                 downloaded. Generally it would be R-x.y.z-<date>.
#
# - DOWNLOAD_SITE: Eclipse binary package download site URL. It should
#                 specify a directory contains eclipse binary.
#
# - REPOSITORY: Plugin repository URL of eclipse update site. This
#                 repository must contains eclipse official plugins
#                 such as EMF, GRF and XSD.
#
# - LANGPACK_URL: URL of language pack for Eclipse SDK package.
#
# - OPENRTP_SITE: OpenRTP tools update site for directory.
#
# - WORK_DIR: Working directory to download eclipse package, extract
#                 it and re-packaging it.
#
# - PKG_DIR: Created packages are stored this directory.
#
# - OS: Supported OS name of eclipse package.
#
# - BIT: Supported OS's platform
#

#------------------------------
# Global variables
#------------------------------
# These global variables are used in the script.
#
# ECLIPSE_DIRS: eclipse directory that is previously installed on the system.
#               This is only used for equinox to install plugins.
#
# ECLIPSE_<OS>_<BIT>: URL to Eclipse package for <OS> <BIT>bit
#               binary. <OS> and <BIT> should appear in OS and BIT global variable.
#
# PLUGINS: Plugins to be installed for OpenRTP tools.
#
# OPENRTP_PLUGINS: OpenRTP plugins without Japanese language pack
#
# OPENRTP_PLUGINS_NL: OpenRTP language pack.
#
# FILE_NAME: File name of downloaded eclipse package.
#
# URL: URL of downloaded eclipse packages.
#
# OPENRTP_JA_VER: OpenRTP (Japanese package) version string
#
# OPENRTP_EN_VER: OpenRTP version string
#
# EQUINOX_LAUNCHER: Equinox launcher jar file with path.
#
# NL_FILE_NAME: langpack file name.
#
#------------------------------

# Eclipse search directories
ECLIPSE_DIRS="$HOME/eclipse $HOME ../ ../../ ../..//usr/lib/ /usr/share"

# Eclipse SDK package information
#ECLIPSE_VERSION="R-3.8-201206081200"
#true ${ECLIPSE_VERSION:="R-4.4.2-201502041700"}
true ${ECLIPSE_VERSION:="R-4.7.3-201803010715"}
#true ${DOWNLOAD_SITE:="http://ftp.jaist.ac.jp/pub/eclipse/eclipse/downloads/drops/${ECLIPSE_VERSION}"}
true ${DOWNLOAD_SITE:="file:///home/openrtm/public_html/pub/eclipse/packages/"}
ECLIPSE_SHORTVER=`echo $ECLIPSE_VERSION | awk 'BEGIN{FS="-";}{print $2;}'`
ECLIPSE_WIN32_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-win32.zip"
ECLIPSE_WIN32_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-win32-x86_64.zip"
ECLIPSE_LINUX_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-linux-gtk.tar.gz"
ECLIPSE_LINUX_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-linux-gtk-x86_64.tar.gz"
ECLIPSE_MACOS_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-macosx-cocoa.tar.gz"
ECLIPSE_MACOS_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-macosx-cocoa-x86_64.tar.gz"

# Eclipse plugins information
#true ${REPOSITORY:="file:///home/openrtm/public_html/pub/eclipse/projects/luna,http://download.eclipse.org/releases/luna"}
true ${REPOSITORY:="file:///home/openrtm/public_html/pub/eclipse/projects/oxygen,http://download.eclipse.org/releases/oxygen"}
PLUGINS="org.eclipse.emf.sdk.feature.group
         org.eclipse.emf.ecore.xcore.sdk.feature.group
         org.eclipse.gef.sdk.feature.group
         org.eclipse.xsd.sdk.feature.group"

# Language package information
#true ${LANGPACK_URL:="http://sourceforge.jp/projects/mergedoc/svn/view/trunk/Pleiades/build/pleiades.zip?view=co&root=mergedoc"}
#true ${LANGPACK_URL:="http://jaist.dl.sourceforge.jp/blancofw/56316/NLpackja-eclipse-SDK-3.8.0-blancofw20120628.zip"}
#true ${LANGPACK_URL:="http://eclipse.stu.edu.tw/technology/babel/babel_language_packs/R0.13.1/luna/BabelLanguagePack-eclipse-ja_4.4.0.v20151128080334.zip"}
#true ${LANGPACK_FILE_NAME:="pleiades.zip"}
#true ${LANGPACK_FILE_NAME:="NLpackja-eclipse-SDK-3.8.0-blancofw20120628.zip"}
#true ${LANGPACK_FILE_NAME:="BabelLanguagePack-eclipse-ja_4.4.0.v20151128080334.zip"}
true ${LANGPACK_FILE_NAME:="BabelLanguagePack-eclipse-ja_4.7.0.v20171231020002.zip"}
true ${LANGPACK_URL:="${DOWNLOAD_SITE}/${LANGPACK_FILE_NAME}"}
#true ${PLEIADES:="YES"}
# openrtp tool information
HERE=`pwd`
true ${OPENRTP_SITE:="file:${HERE}/sitetool/openrtp_site"}
OPENRTP_PLUGINS="jp.go.aist.rtm.rtcbuilder.feature.feature.group
         jp.go.aist.rtm.rtsystemeditor.feature.feature.group"
OPENRTP_PLUGINS_NL="jp.go.aist.rtm.rtcbuilder.nl1.feature.feature.group
         jp.go.aist.rtm.rtsystemeditor.nl1.feature.feature.group"

# Working dir for download/extract/pack eclipse files
true ${WORK_DIR:="./work"}
# Package store directory
true ${PKG_DIR:="./packages"}

# Supported OS/type
true ${OS:="WIN32 LINUX MACOS"}
true ${BIT:="32 64"}

# These variables are overwritten in the script.
FILE_NAME=""
URL=""

echo "ECLIPSE_VERSION: $ECLIPSE_VERSION"
echo "DOWNLOAD_SITE:   $DOWNLOAD_SITE"
echo "REPOSITORY:      $REPOSITORY"
echo "LANGPACK_URL:    $LANGPACK_URL"
echo "OPENRTP_SITE:    $OPENRTP_SITE"
echo "WORK_DIR:        $WORK_DIR"
echo "PKG_DIR:         $PKG_DIR"
echo "OS:              $OS"
echo "BIT:             $BIT"

#------------------------------
# functions
#------------------------------

#------------------------------------------------------------
# get_version
#
# This function gets version number and project version string
# from version text file.
# ------------------------------------------------------------
get_version()
{
    if test ! -f ./version.txt ; then
        echo "version.txt file not found. Aborting."
        return 1 
    fi
    if test "x$VERSION" = "x" || test "x$PROJECT_VERSION" = "x" ; then
        echo "Environment variable VERSION/PROJECT_VERSION is not set."
        echo "Getting from ./version text."
        . ./version.txt
    fi
    ver=`echo $PROJECT_VERSION | sed -e 's/\.//g'`
    # openrtp package name
    OPENRTP_JA_VER="openrtp${ver}-ja"
    OPENRTP_EN_VER="openrtp${ver}"
    return 0
}

#------------------------------------------------------------
# find_eclipsehome
#
# This function checks ECLIPSE_HOME env variable and if it is
# not set, it searches an eclipse directory under ECLIPSE_DIRS,
# and set ECLIPSE_HOME env variable.
# ------------------------------------------------------------
find_eclipsehome()
{
    if test ! "x$ECLIPSE_HOME" = "x" ; then
        if test -d $ECLIPSE_HOME ; then
            return 0
        fi
        echo "ECLIPSE_HOME $ECLIPSE_HOME does not exist."
    fi
    echo "Environment variable ECLIPSE_HOME is not set. Searching..."
    for d in $ECLIPSE_DIRS ; do
        tmp=`find -L $d -name .eclipseproduct`
        if test "x$tmp" = "x" ; then
            continue
        fi
        for e in $tmp ; do
            edir=`dirname $e`
            if test -f $edir/eclipse.ini && test -d $edir/plugins ; then
                export ECLIPSE_HOME="$edir"
                return 0
            fi
        done
    done
    echo "eclipse not found. Please install eclipse and set ECLIPSE_HOME."
    return 1
}

#------------------------------------------------------------
# find_equinox()
#------------------------------------------------------------
find_equinox()
{
    equinox=`ls $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar`
    for e in $equinox ; do
        EQUINOX_LAUNCHER=$e
        return 0
    done
    echo "Equinox Launcher jar file not found. Aborting."
    return 1
}

#------------------------------------------------------------
# download_eclipse
#------------------------------------------------------------
download_eclipse()
{
    if test $# -ne 1 ; then
        echo "download_eclipse should have one argument. Aborting."
        return 1
    fi
    if test ! -d $WORK_DIR ; then
        mkdir -p $WORK_DIR
    fi
    URL=$1
    fname=`basename $URL`
    FILE_NAME=$WORK_DIR/`basename $URL`
    if test "x$FILE_NAME" = "x" ; then
        echo "Invalid URL has been given: $URL"
        echo "Aborting..."
        return 1
    fi

    suffix=`echo $fname | sed 's/eclipse-.*\.[0-9][0-9]-//'`
    ver=`echo $fname | sed 's/eclipse-.*-\([0-9\.]*\)-.*/\1/' | sed -e 's/\.//g'`
    PKG_NAME_JA="eclipse${ver}-${OPENRTP_JA_VER}-$suffix"
    PKG_NAME_EN="eclipse${ver}-${OPENRTP_EN_VER}-$suffix"

    if test -f $FILE_NAME; then
        echo "$FILE_NAME already exists."
        return 0
    fi
    echo "Downloading $FILE_NAME..."
    curl -o "$FILE_NAME" "$URL"
    if test $? -ne 0 ; then
        echo "curl failed. Aborting..."
        return 1
    fi
    file_info=`ls $FILE_NAME`
    echo "Donwload done: $file_info"
    return 0
}

#------------------------------------------------------------
# extract_eclipse
#------------------------------------------------------------
extract_eclipse()
{
    rm -rf $WORK_DIR/eclipse
    zip=`echo $FILE_NAME | grep '[zZ][iI][pP]'`
    tar=`echo $FILE_NAME | grep '[tT][aA][rR].[gG][zZ]'`
    if test ! "x$zip" = "x" ; then
        echo "Extracting zip file..."
        unzip $FILE_NAME -d $WORK_DIR >/dev/null 2>&1 && return 0
        echo "Failed to extract zip file: $FILE_NAME. Aborting..."
    elif test ! "x$tar" = "x" ; then
        echo "Extracting tar.gz file..."
        tar xvzf $FILE_NAME -C $WORK_DIR >/dev/null 2>&1 && return 0
        echo "Failed to extract tar.gz file: $FILE_NAME. Aborting..."
    else
        echo "Unknown file extention. Aborting..."
    fi
    return 1
}

#------------------------------------------------------------
# install_plugins
#------------------------------------------------------------
install_plugins()
{
    cmd="java -jar $EQUINOX_LAUNCHER"
    app_opt="-application org.eclipse.equinox.p2.director"
    if test "x$os" = "xMACOS" ; then
        dest_opt="-destination $WORK_DIR/Eclipse.app/Contents/Eclipse/"
    else
        dest_opt="-destination $WORK_DIR/eclipse"
    fi

    scheme=`echo $REPOSITORY | egrep '^(http|https|ftp|file):\/\/'`
    if test "x$scheme" = "x" ; then
        # is local file?
        is_abs=`echo $REPOSITORY | grep '^\/'`
        if test "x$is_abs" = "x" ; then
            REPOSITORY=`pwd`/$REPOSITORY
        fi
        REPOSITORY="file://$REPOSITORY"
    fi
    repo_opt="-repository $REPOSITORY"

    for p in $PLUGINS ; do
        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
        $cmd $app_opt $dest_opt $repo_opt -installIU $p
        if test $? -ne 0 ; then
            echo "Plugin: $p installation failed. Aborting."
            return 1 
        fi
    done
    return 0
}

#------------------------------------------------------------
# insall_rtmtools
#
# Installing OpenRTP tools features
#------------------------------------------------------------
install_rtmtools()
{
    cmd="java -jar $EQUINOX_LAUNCHER"
    app_opt="-application org.eclipse.equinox.p2.director"
    if test "x$os" = "xMACOS" ; then
        dest_opt="-destination $WORK_DIR/Eclipse.app/Contents/Eclipse/"
    else
        dest_opt="-destination $WORK_DIR/eclipse"
    fi
    repo_opt="-repository $OPENRTP_SITE"

    for p in $OPENRTP_PLUGINS ; do
        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
        $cmd $app_opt $dest_opt $repo_opt -installIU $p
        if test $? -ne 0 ; then
            echo "Plugin: $p installation failed. Aborting."
            return 1
        fi
    done

    chmod 755 openrtp
    if test "x$os" = "xLINUX" ; then
        cp openrtp $WORK_DIR/eclipse/
    elif test "x$os" = "xMACOS" ; then
        cp openrtp $WORK_DIR/Eclipse.app/Contents/MacOS/
        info="$WORK_DIR/Eclipse.app/Contents/Info.plist"
        sed -i -e 's/<string>eclipse<\/string>/<string>openrtp<\/string>/g' $info
    fi
    return 0
}

#------------------------------------------------------------
# insall_rtmtools_nl
#
# Installing OpenRTP language packages
#------------------------------------------------------------
install_rtmtools_nl()
{
    cmd="java -jar $EQUINOX_LAUNCHER"
    app_opt="-application org.eclipse.equinox.p2.director"
    if test "x$os" = "xMACOS" ; then
        dest_opt="-destination $WORK_DIR/Eclipse.app/Contents/Eclipse/"
    else
        dest_opt="-destination $WORK_DIR/eclipse"
    fi
    repo_opt="-repository $OPENRTP_SITE"

    for p in $OPENRTP_PLUGINS_NL ; do
        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
        $cmd $app_opt $dest_opt $repo_opt -installIU $p
        if test $? -ne 0 ; then
            echo "Plugin: $p installation failed. Aborting."
            return 1 
        fi
    done
    return 0
}

#------------------------------------------------------------
# create_package
#
# Packing eclise directory
#------------------------------------------------------------
create_package()
{
    if test $# -ne 1 ; then
        echo "create_package needs at least one argument."
        return 1
    fi
    pkg_name=`basename $1`
    zip=`echo $pkg_name | grep '[zZ][iI][pP]'`
    tar=`echo $pkg_name | grep '[tT][aA][rR].[gG][zZ]'`
    echo $zip
    echo $tar
    if test ! "x$zip" = "x" ; then
        echo "Creating zip file..."
        basedir=`pwd`
        cd $WORK_DIR
        if test "x$os" = "xMACOS" ; then
            find Eclipse.app > .zip_list
        else
            find eclipse > .zip_list
        fi
        (cat .zip_list | zip -@ $pkg_name >/dev/null 2>&1 )
        rm -f .zip_list
        cd $basedir
        if test $? -ne 0 ;then
            echo "Failed to archive zip file: $pkg_name. Aborting..."
            return 1
        fi
    elif test ! "x$tar" = "x" ; then
        echo "Creating tar.gz file..."
        basedir=`pwd`
        cd $WORK_DIR
        if test "x$os" = "xMACOS" ; then
            tar cvzf $pkg_name Eclipse.app >/dev/null 2>&1
        else
            tar cvzf $pkg_name eclipse >/dev/null 2>&1
        fi
        cd $basedir
        if test $? -ne 0 ; then
            echo "Failed to archive tar.gz file: $pkg_name. Aborting..."
            return 1
        fi
    else
        echo "Unknown file extention. Aborting..."
        return 1
    fi
    if test ! -d $PKG_DIR ; then
        mkdir -p $PKG_DIR
    fi
    mv $WORK_DIR/$pkg_name $PKG_DIR
    return 0

}

#------------------------------------------------------------
# download_langpack
#
# Downloading Eclipse's language pack
#------------------------------------------------------------
download_langpack()
{
    echo "Downloading Eclipse language pack: $LANGPACK_URL"
    if test "x$LANGPACK_FILE_NAME" = "x" ; then
        echo "Invalid URL specified"
    fi
    if test ! -f $WORK_DIR/$LANGPACK_FILE_NAME ; then
        curl -o $WORK_DIR/$LANGPACK_FILE_NAME $LANGPACK_URL
    fi
    if test $? -ne 0 ; then
        echo "Downloading language pack failed. Aborting."
        return 1
    fi
    return 0
}

#------------------------------------------------------------
# apply_langpack
#
# Extract language pack archive and apply it to eclipse
#------------------------------------------------------------
apply_langpack()
{
    echo "Applying language package."
    if test "x$PLEIADES" != "x"; then
        unzip -o $WORK_DIR/$LANGPACK_FILE_NAME -d $WORK_DIR/eclipse
        if test $? -ne 0 ; then
            echo "Unzipping $LANGPACK_FILE_NAME failed. Aborting."
            return 1
        fi
        if test "x$os" = "xMACOS" ; then
            cp -rf ${WORK_DIR}/eclipse/* ${WORK_DIR}/Eclipse.app/Contents/Eclipse/
        fi

        echo "Applying langpack: Activating pleiades plugin."
        pleiades_jar="plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar"
        if test "x$os" = "xMACOS" ; then
            echo "-javaagent:../../../$pleiades_jar" \
                >> $WORK_DIR/Eclipse.app/Contents/Eclipse/eclipse.ini
        else
            echo "-javaagent:$pleiades_jar" \
                >> $WORK_DIR/eclipse/eclipse.ini
        fi

        echo "Applying langpack: Modifying pleiades exclude properties."
        pleiades_pkg="jp.sourceforge.mergedoc.pleiades"
        if test "x$os" = "xMACOS" ; then
            pleiades_conf="${WORK_DIR}/Eclipse.app/Contents/Eclipse/plugins/${pleiades_pkg}/conf"
        else
            pleiades_conf="${WORK_DIR}/eclipse/plugins/${pleiades_pkg}/conf"
        fi
        exclude_prop="${pleiades_conf}/translation-exclude-package.properties"
        echo "default=jp.go.aist.rtm.systemeditor" >> $exclude_prop

        echo "Applying patch for pleiades-config.xml"
        patch $pleiades_conf/pleiades-config.xml pleiades-config.xml.patch
        if test $? -ne 0 ; then
            echo "Patching failed. Aborting."
            return 1
        fi
    else
        unzip -o $WORK_DIR/$LANGPACK_FILE_NAME -d $WORK_DIR
        if test $? -ne 0 ; then
            echo "Unzipping $LANGPACK_FILE_NAME failed. Aborting."
            return 1
        fi
        if test "x$os" = "xMACOS" ; then
            cp -rf ${WORK_DIR}/eclipse/* ${WORK_DIR}/Eclipse.app/Contents/Eclipse/
        fi
    fi
    echo "done"
    return 0
}

#
# Cleanup working directory
#------------------------------------------------------------
cleanup_workdir()
{
    rm -rf $WORK_DIR/eclipse
    if test "x$os" = "xMACOS" ; then
        rm -rf $WORK_DIR/Eclipse.app
    fi
}

#------------------------------
# main
#------------------------------
export LC_ALL=C
cd `dirname $0`

get_version || { exit 1 ; } 

find_eclipsehome || { exit 1 ; }
find_equinox || { exit 1 ; }

for os in $OS ; do
    for bit in $BIT ; do
        eval "url=\$ECLIPSE_${os}_${bit}"
        download_eclipse $url || { exit 1 ; }
        extract_eclipse || { exit 1 ; }
        install_plugins || { exit 1 ; }
        install_rtmtools || { exit 1 ; }
        # English version
        create_package $PKG_NAME_EN || { exit 1 ; }

        # Japanese version
        download_langpack || { exit 1 ; }
        apply_langpack || { exit 1 ; }
        install_rtmtools_nl || { exit 1 ; }
        create_package $PKG_NAME_JA || { exit 1 ; }

        cleanup_workdir
    done
done

# end of script
#------------------------------------------------------------
# * Development notes
#
# ** Eclipse download site
# http://www.eclipse.org/downloads/
#
# *** Eclipse project archived downloads site
# http://archive.eclipse.org/eclipse/downloads/index.php
#
# *** NLPack
# http://sourceforge.jp/projects/blancofw/wiki/nlpack.eclipse.juno-I201206281030
#
# *** Plugin download site
# http://download.eclipse.org/releases/<code name>/
# code name: indigo, juno, etc...
#
# Plugin installation from CUI
# http://o440.wordpress.com/2011/03/21/eclipse-plugin-cui-installation/
#
# ** How to install plugins from command line
#
# Plugin installation from command line has two ways. But using
# org.eclipse.update.core.standaloneUpdate is obsolete. Now we should
# use org.eclipse.equinox.p2.director
#
# [OLD]
# java -jar <eclipse_dir>/plugins/org.eclipse.equinox.launcher_<ver>
#      -application  org.eclipse.update.core.standaloneUpdate
#      -command search -from <repository URL>
# Commands (install, uninstall, addSite, removeSite, search, enable, disable)
# See http://help.eclipse.org/indigo/index.jsp?
#     topic=/org.eclipse.platform.doc.isv/reference/misc/update_standalone.html
#
# [NEW]
# java -jar ~/eclipse-3.8/plugins/org.eclipse.equinox.launcher_<ver>.jar
#      -application org.eclipse.equinox.p2.director
#      -repository http://download.eclipse.org/releases/juno/
#      -installIU org.eclipse.emf.sdk.feature.group
#      -destination /home/n-ando/work/eclipse/eclipse_linux64/
#
# Options:
# -application org.eclipse.equinox.p2.director
# -metadataRepository
# -artifactRepository
# -repository
# -installIU
# -uninstallIU
# -destination
# -list
# -profile
# -profileProperties
# -bundlepool
# -p2.os
# -p2.ws
# -p2.arch
# -roaming
# -shared
# -verifyOnly
#
# See: http://help.eclipse.org/galileo/index.jsp?
#      topic=/org.eclipse.platform.doc.isv/guide/p2_director.html
#
# To install rtmtools, thw following plugins features should be installed.
# - org.eclipse.emf.sdk.feature.group
# - org.eclipse.emf.ecore.xcore.sdk.feature.group
# - org.eclipse.gef.sdk.feature.group
# - org.eclipse.xsd.sdk.feature.group
#
# for CDT
# - org.eclipse.cdt.feature.group
#
# for plugins
# Repository for juno: http://download.eclipse.org/releases/juno/
#
# ** Eclipse s Client Agent name
#  Jakarta Commons-HttpClient/3.1
#
# ** Mirroring eclipse site
#
# *** Mirroring metadata
#
# java -jar ~/eclipse-3.8/plugins/org.eclipse.equinox.launcher_<ver>.jar
#      -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication
#      -source Insert Source URL
#      -destination <mirror directory>
#
# *** Mirroring artifact
#
# java -jar ~/eclipse-3.8/plugins/org.eclipse.equinox.launcher_<ver>.jar
#      -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication
#      -source Insert Source URL
#      -destination <mirror directory>
#
# http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring
# https://github.com/adangel/custom-eclipse/blob/master/create-mirror.sh
#
#------------------------------------------------------------
